///<reference path='typings/jquery/jquery.d.ts' />
///<reference path='typings/jquery.validation/jquery.validation.d.ts' />
// Module
var bgu;
(function (bgu) {
    function init() {
        // initialize all modules..
        validation.init();
    }
    bgu.init = init;
    var validation;
    (function (validation) {
        function init() {
        	// attach invalid-form handler to form..
        	var settings = $.data($('form')[0], 'validator').settings;
        	console.log(settings);
        	var fnHightlight = settings.highlight;
        	settings.highlight = function (element, errorClass, validClass) {
        		$(element).closest('.form-group').addClass('has-error');
        		fnHightlight(element, errorClass, validClass);
        	};
        	var fnUnHightlight = settings.unhighlight;
        	settings.unhighlight = function (element, errorClass, validClass) {
        		$(element).closest('.form-group').removeClass('has-error');
        		fnUnHightlight(element, errorClass, validClass);
        	};
        	//$("form").bind("invalid-form.validate", function (form, validator) {
            //	console.log('invalid-form.validate event');
            //	console.log($(this));
            //	console.log(validator)
            //	console.log(validator.currentElements.length)
            //	console.log(validator.errorList.length)
            //	console.log(validator.toShow.length)
            //	$(validator.currentElements).each(function () {
            //		console.log($(this));
            //		$(this).closest('.form-group').removeClass('has-error');
            //	});
            //	$(validator.errorList).each(function () {
            //		console.log($(this));
            //		$(this.element).closest('.form-group').addClass('has-error');
            //	});
            //	//$(this).find('.form-group').each(function () {
            //	//	console.log($(this));
            //	//	console.log('.input-validation-error length: ' + $(this).find('.input-validation-error').length)
            //    //    if ($(this).find('.input-validation-error').length > 0) {
            //    //        // contains an error..
            //    //        $(this).addClass('has-error');
            //    //    } else {
            //    //        // error free..
            //    //        $(this).removeClass('has-error');
            //    //    }
            //    //});
            //});
        }
        validation.init = init;
    })(validation || (validation = {}));
})(bgu || (bgu = {}));
$(function () {
    bgu.init();
});
//# sourceMappingURL=Site.js.map
